import { ChangeDetectionStrategy, ChangeDetectorRef, Component } from '@angular/core';

@Component({
  selector: 'app-demo1',
  templateUrl: './demo1.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class Demo1Component {
  loading = false;

  constructor(private cdr: ChangeDetectorRef) {}

  change(val) {
    this.loading = true;
    setTimeout(() => {
      this.loading = false;
      this.cdr.markForCheck();
    }, 500);
  }
}
